//
//  UIView+Extension.h
//  OC_Poj_demo
//
//  Created by weixin on 2018/6/24.
//  Copyright © 2018年 weixn. All rights reserved.
//

#import <UIKit/UIKit.h>

/// 边框类型(位移枚举)

typedef NS_OPTIONS(NSUInteger, UIBorderSideType) {
    UIBorderSideTypeAll  = 0,
    UIBorderSideTypeTop = 1 << 0,
    UIBorderSideTypeBottom = 1 << 1,
    UIBorderSideTypeLeft = 1 << 2,
    UIBorderSideTypeRight = 1 << 3,
};



@interface UIView (Extension)

@property (nonatomic, assign) CGFloat x;
@property (nonatomic, assign) CGFloat y;
@property (nonatomic, assign) CGFloat width;
@property (nonatomic, assign) CGFloat height;
@property (nonatomic, assign) CGSize size;
@property (nonatomic, assign) CGPoint origin;


@property (nonatomic, assign) CGFloat centerX;
@property (nonatomic, assign) CGFloat centerY;


@property (nonatomic, assign) CGFloat top;
@property (nonatomic, assign) CGFloat bottom;
@property (nonatomic, assign) CGFloat left;
@property (nonatomic, assign) CGFloat right;

/*
 UIView设置阴影
 
 @param color 阴影颜色
 @param offset 阴影偏移
 @param opacity 阴影透明度
 @param radius 阴影半径
 */
- (void)setShadowType1WithColor:(UIColor *)color offset:(CGSize)offset opacity:(CGFloat)opacity radius:(CGFloat)radius;


- (void)setShadowType2WithColor:(UIColor *)color offset:(CGSize)offset opacity:(CGFloat)opacity radius:(CGFloat)radius;

/*
 阴影和圆角并存 必须保证子视图不能超过夫视图
 */
- (void)setShadowRadiusWithColor:(UIColor *)color offset:(CGSize)offset opacity:(CGFloat)opacity radius:(CGFloat)radius;
/**
 UIView设置边框
 
 @param color 边框颜色
 @param width 边框宽度
 */
- (void)setBorderWithColor:(UIColor *)color width:(CGFloat)width;


/**
 UIView切圆
 
 @param radius 切圆半径
 @param isMasks 是否masksToBounds
 */
- (void)setCornerRadiusWithRadius:(CGFloat)radius isMasks:(BOOL)isMasks;





//找到上一级响应者
- (id)findResponderWithClass:(Class)aclass;

- (void)clipCornerWithCornerRadius:(CGFloat)cornerRadius
                       borderColor:(UIColor *)borderColor
                       borderWidth:(CGFloat)borderWidth
                           TopLeft:(BOOL)topLeft
                          TopRight:(BOOL)topRight
                        BottomLeft:(BOOL)bottomLeft
                       BottomRight:(BOOL)bottomRight;

- (void)clipAllCornerWithCornerRadius:(CGFloat)cornerRadius
                          borderColor:(UIColor *)borderColor
                          borderWidth:(CGFloat)borderWidth;


//获取当前导航栏
- (UINavigationController*)getNav;

//获取当前控制器
- (UIViewController*)getViewController:(Class)classe;

- (UIView *)borderForColor:(UIColor *)color borderWidth:(CGFloat)borderWidth borderType:(UIBorderSideType)borderType;

@end
